import type { RouteRecordRaw } from 'vue-router';
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';

const BasicLayout = () => import('#/layouts/basic.vue');
const AuthLayout = () => import('#/layouts/login.vue');
const Lesson = () => import('#/layouts/lesson.vue')
const RouterView = () => import('#/layouts/router-view.vue')
const AuthPageLayout = () => import('#/layouts/auth.vue');

/** 全局404页面 */
const fallbackNotFoundRoute: RouteRecordRaw = {
  component: () => import('#/views/_core/fallback/not-found.vue'),
  meta: {
    hideInBreadcrumb: true,
    hideInMenu: true,
    hideInTab: true,
    title: '404',
  },
  name: 'FallbackNotFound',
  path: '/:path(.*)*',
};

/** 基本路由，这些路由是必须存在的 */
const coreRoutes: RouteRecordRaw[] = [
  /**
   * 根路由
   * 使用基础布局，作为所有页面的父级容器，子级就不必配置BasicLayout。
   * 此路由必须存在，且不应修改
   */
  {
    component: BasicLayout,
    meta: {
      hideInBreadcrumb: true,
      title: 'Root',
    },
    name: 'Root',
    path: '/',
    redirect: DEFAULT_HOME_PATH,
    children: [],
  },
  {
    component: AuthLayout,
    // component: AuthPageLayout,
    meta: {
      hideInTab: true,
      title: 'Authentication',
    },
    name: 'Authentication',
    path: '/auth',  
    redirect: LOGIN_PATH,
    children: [
      {//登录
        name: 'Login',
        path: 'login',
        component: () => import('#/views/logins/login.vue'),
        // component: () =>import('#/views/_core/authentication/login.vue'),
        meta: {
          title: '登录',
        },
      },
      {//注册
        name: 'Register',
        path: 'register',
        component: () => import('#/views/logins/register.vue'),
        meta: {
          title: '注册',
        },
      },

    ],
  },
  //课程
  {
    component: Lesson,
    meta: {
      hideInTab: true,
      title: 'Lesson',
    },
    name: 'Lesson',
    path: '/lesson',
    redirect: '/lesson/home',
    children: [
      {
        name: 'Home',
        path: 'home',
        component: () => import('#/views/lesson/home.vue'),
        meta: {
          title: '认证首页',
        }
      },
      {
        name: 'Intro',
        path: 'intro',
        component: () => import('#/views/lesson/intro.vue'),
        meta: {
          title: '课程介绍',
        }
      },
      {
        name: 'Learn',
        path: 'learn',
        component: () => import('#/views/lesson/learn.vue'),
        meta: {
          title: '课程学习',
        },
      }
    ]
  }
];

export { coreRoutes, fallbackNotFoundRoute };
